//	 "God IS MY REFUGE": DO EDUCATION AND NEWS CONSUMPTION PROMPT AFRICANS TO PUT MORE TRUST IN THE COVID-19 VACCINE THAN IN PRAYER THAN IN? 

								*Daniel Tuki*
								

* This study is based on the Round 8 Afrobarometer pooled survey data. To access the dataset and survey questionnaire visit: https://www.afrobarometer.org/

* The variable names are specified in brackets, while the variable numbers in the survey questionnaire is specified in square brackets

** First I present the codes used to create the variables for the regression models, after which I present the codes required to execute the regression models. 




********************************************************************************
*				CREATING THE VARIBALES FOR THE REGRESSION MODELS			   *
********************************************************************************

//							DEPENDENT VARIABLE

// Prayer > Vaccine (prayer)[COV18]: This variable measures the extent to which respondents believe prayer is more effective than a vaccine in preventing COVID-19.
codebook COV18 
gen v1 = COV18
* To treat "don't know" "not applicable" and "refused to answer" resposnes as missing observations: 
replace v1 = . if v1 > 5
* To invert the variable so that higher ordianl values denote greater trust in prayer: 
gen prayer = 6 - v1

// Prayer (binary) (bin_prayer): This dummy variable is a reduced form of "Prayer > Vaccine" in which I collapsed the various categories into a dummy variable. This variuable  takes a value of 1 if the respondent beleives prayer is more effective than a vaccine, and 0 if they either either believe both are equally effective, or a vaccine is more effective than prayer. 
gen bin_prayer = . 
replace bin_prayer = 0 if prayer == 1
replace bin_prayer = 0 if prayer == 2
replace bin_prayer = 0 if prayer == 3
replace bin_prayer = 1 if prayer == 4
replace bin_prayer = 1 if prayer == 5



//				EXPLANATORY VARIABLE

// Educational level (educ) [Q97]: This variable measures the highest level of education respondents have attained. 
tab Q97
tab Q97, nolabel
gen educ = Q97
* To treat "don't know" responses as missing
replace educ = . if educ > 9


// News index (news_index): This is an additive indicator that measures the frequency with which respondents obtain news from the radio, TV, newspaper, internet, and social media. Higher values on the index denote greater news consumption. 

* Radio (radio) [Q55A]: 
codebook Q55A
gen radio = Q55A
* To treat "don't know" responses as missing
replace radio = . if radio > 4

* Television (tv) [Q55B]: 
codebook Q55B
gen tv = Q55B
* To treat "don't know" responses as missing
replace tv = . if tv > 4

* Newspaper (paper) [Q55C]: 
codebook Q55C
gen paper = Q55C
* To treat "don't know" responses as missing
replace paper = . if paper > 4

* Internet (internet) [Q55D]: 
codebook Q55D
gen internet = Q55D
* To treat "don't know" responses as missing
replace internet = . if internet > 4

* Social media (social) [Q55E]: 
codebook Q55E
gen  social = Q55E
* To treat "don't know" responses as missing
replace social = . if social > 4

* To generate an additive index for news consumption; 
gen news_index = radio + tv + paper + internet + social

* To obtain the Cronbach Alpha statistic for the five items:
alpha radio tv paper internet social

* Traditional media (traditional_media): This sums the frequency with which respondents get news from traditional news sources (i.e., Radio, Television, and Newspapers)
gen traditional_media = radio + tv + paper

* Non-traditional news media (modern_media): This sums the frequency with which respondents obtain news from non-traditional news media sources (i.e., internet and social media)
gen modern_media = social + internet

* Note that that the news consumption index is also the sum of the traditional and non-traditional news sources. 





//				CONTROL VARIABLES

// Lived Poverty index (index_deprive) [Q7A - Q7E]: This is an additive indicator that measures the frequency with which respondents or members of their households have gone without basic necessities. Higher values on the index denote greater deprivation. 

* Food (food) [Q7A]
codebook Q7A
gen food = Q7A
* To treat "don't know" and "refused to answer" responses as missing: 
replace food = . if food > 4

* Water (water) [Q7B]
codebook Q7B
gen water = Q7B
* To treat "don't know" and "refused to answer" responses as missing: 
replace water = . if water > 4

* Medicine (medicine) [Q7C]
codebook Q7C
gen medicine = Q7C
* To treat "don't know" and "refused to answer" responses as missing: 
replace medicine = . if medicine > 4

* Cooking fuel (fuel) [Q7D]
codebook Q7D
gen fuel = Q7D
* To treat "don't know" and "refused to answer" responses as missing: 
replace fuel = . if fuel > 4

* Income (income) [Q7E]
codebook Q7E
gen income = Q7E
* To treat "don't know" and "refused to answer" responses as missing: 
replace income = . if income > 4

* To develop additive Lived Poverty Index
gen index_deprive = food + water + medicine + fuel + income

* To obtain the Cronbach Alpha statistic for the five items:
alpha food water medicine fuel income


// Ill with COVID-19 (ill_covid) [COV2]: This is a dummy variable that takes a value of 1 if the respondent has been ill with COVID-19 and 0 otherwise. 
codebook COV2
gen ill_covid = COV2
replace ill_covid = 0 if ill_covid == 2
* To treat "don't know" and "refused to answer" responses as missing: 
replace ill_covid = . if ill_covid > 1


// Trust in government (president)[Q41A]: This variable measures the degree to which respondents trust the president on a scale ranging from 0 = not at all" to "3 = a lot."
codebook Q41A
gen president = Q41A
replace president = . if president > 3


// Male (male) [Q101]: This variable indicates respondents' gender with 1 denoting male and 0 female. 
codebook Q101
gen male = Q101
replace male = 0 if male == 2


// Age (age) [Q1]: This measaures how old respondents are in years. 
tab Q1
tab Q1, nolabel
gen age = Q1
* To treat "don't know" responses as missing
replace age = . if age > 115


// Rural (rural) [URBRUR]: this is a dummy variable that takes a value of 1 if a respondent resides in a rural area, and 0 if they live in an urban center. 
gen rural = . 
replace rural = 1 if URBRUR == 2
replace rural = 0 if URBRUR == 1


// Reliigous affiliation (Q98A & Q98AOTHER): I classified the respondents into four major religious categories: Christians, Muslims, Other religions, and No religion. Africans are typically either muslims or Christians.
 
tab Q98A
tab Q98A, nolabel
tab Q98AOTHER
			
// No religion (no_relig) [Based on Q98A & Q98AOTHER]: This is a dummy variable that is coded as 1 if a respondent has no religious affiliation, and 0 if they have a religious affiliation. 
tab Q98A
tab Q98A, nolabel
gen no_relig = 0
* To code respondents who say they no religious affiliation as 1: 
replace no_relig = 1 if Q98A == 0
* To code respondents who state that they are Atheists or Agnostocs as 1: 
replace no_relig = 1 if Q98A == 28
replace no_relig = 1 if Q98A == 29
* To code respondents with no religion under the variable "Q98OTHER"
replace no_relig = 1 if Q98AOTHER == "NON PRATIQUANT"
replace no_relig = 1 if Q98AOTHER == "PAGAN"
replace no_relig = 1 if Q98AOTHER == "THE NEXT PERSON IS HIS RELIGION, I.E DEALING WITH"
* To code respondents who chose the "don't know" and "refused to answer" response categories as having no religion, since they do not explicitly state that they have a religious affiliation (n = 194): 
replace no_relig = 1 if Q98A == 9998
replace no_relig = 1 if Q98A == 9999
* To code missing observations as that (n = 3): 
replace no_relig = . if Q98A == -1



// Muslim (muslim) [Based on Q98A & Q98AOTHER]: This is a dummy variable that is coded as 1 if a respomndent is Muslim and 0 othereise.
gen muslim = 0
* To code the Muslim denominations as 1:
replace muslim = 1 if Q98A == 18
replace muslim = 1 if Q98A == 19
replace muslim = 1 if Q98A == 20
replace muslim = 1 if Q98A == 21
replace muslim = 1 if Q98A == 22
replace muslim = 1 if Q98A == 23
replace muslim = 1 if Q98A == 24
replace muslim = 1 if Q98A == 660
replace muslim = 1 if Q98A == 1340

* To code missing observations as that (n = 3): 
replace muslim = . if Q98A == -1

* To identify the Muslims under the variable Q98OTHER
replace muslim = 1 if Q98AOTHER == "AHMADIYA MUSLIM"
replace muslim = 1 if Q98AOTHER == "IZALA"
replace muslim = 1 if Q98AOTHER == "Islamica"
replace muslim = 1 if Q98AOTHER == "moculumano"
replace muslim = 1 if Q98AOTHER == "musulumano"



// Traditional religion (trad) [Based on Q98A & Q98AOTHER]: This is a dummy variable that is coded as 1 if a respondent practices traditional/ethnic religion or vodoo, and 0 otherwise. 
gen trad = 0
* To code traditional/ethnic religion practitioners as 1: 
replace trad = 1 if Q98A == 25
* To code respondents under the variable Q98OTHER who practice traditional religion: 
replace trad = 1 if Q98AOTHER == "ANIMISTE"
replace trad = 1 if Q98AOTHER == "ANIMISTES"
replace trad = 1 if Q98AOTHER == "ANIMISTRE"
replace trad = 1 if Q98AOTHER == "IDOL WORSHIPPER"
replace trad = 1 if Q98AOTHER == "MANYOLOI/ SPIRITS"
replace trad = 1 if Q98AOTHER == "RELIGIAO AFRICANA"
replace trad = 1 if Q98AOTHER == "RELIGION COUTUMIERE"
replace trad = 1 if Q98AOTHER == "WORSHIP IDOL"

* To code missing observations as that (n = 3): 
replace trad = . if Q98A == -1



// Other religion (other_relig) [Based on Q98A & Q98AOTHER]: This is a dummy variable that is coded as 1 if a respondent practices any other religion besides Islam, Christianity, traditional religion, or have no religion. Respondents coded as 1 in this variable include Jewish, Hindu, Bahai etc. 

gen other_relig = 0
* To code Hindus as 1
replace other_relig = 1 if Q98A == 26
* To code Bahai as 1
replace other_relig = 1 if Q98A == 27
* To code Jewish as 1
replace other_relig = 1 if Q98A == 34
* To code Tamoule [Tamil] as 1
replace other_relig = 1 if Q98A == 900
* To code code other religous groups under the variable "Q98AOTHER"
replace other_relig = 1 if Q98AOTHER == "BHUDIST"
replace other_relig = 1 if Q98AOTHER == "BOUDDHISTE"
replace other_relig = 1 if Q98AOTHER == "BOUDHA"
replace other_relig = 1 if Q98AOTHER == "BOUDHISME"
replace other_relig = 1 if Q98AOTHER == "BOUDHISTE"
replace other_relig = 1 if Q98AOTHER == "BOUDISTE"
replace other_relig = 1 if Q98AOTHER == "BREMAN"
replace other_relig = 1 if Q98AOTHER == "ECKANKAR"
replace other_relig = 1 if Q98AOTHER == "ECKANKER"
replace other_relig = 1 if Q98AOTHER == "ECUZE"
replace other_relig = 1 if Q98AOTHER == "HARE KRISHNA"
replace other_relig = 1 if Q98AOTHER == "HINDOU MUSULMAN"
replace other_relig = 1 if Q98AOTHER == "IJVFA IERRA"
replace other_relig = 1 if Q98AOTHER == "MAHIKARI"
replace other_relig = 1 if Q98AOTHER == "RASTAFARIAN"
replace other_relig = 1 if Q98AOTHER == "RAWANO"
replace other_relig = 1 if Q98AOTHER == "SPIRITUAL"
replace other_relig = 1 if Q98AOTHER == "TUNISIAN"
replace other_relig = 1 if Q98AOTHER == "liga prema"

* To code missing observations as that (n = 3): 
replace other_relig = . if Q98A == -1



// Christian (christian) [Based on Q98A & Q98AOTHER]: This is a dummy variable that is coded as 1 if a respondent belongs to any Christian denomination and 0 otherwise: 

* Because I have already categorized all the respondents into a religious group earlier, except for Christians, I could simply generate the dummy variable for Christian by generating a variable with all values as 1, and then re-coding the non-Christian observations as 0: 

gen christian = 1
* To code individuals with no religion, muslims, traditional religion, and other religions as 0:
replace christian = 0 if no_relig == 1
replace christian = 0 if muslim == 1
replace christian = 0 if trad == 1
replace christian = 0 if other_relig == 1
* To code missing observations as that (n = 3): 
replace christian = . if Q98A == -1




// The question from which the dependent variable was derived was only asked in 15 selected countries (Benin, Cameroon, Eswatini, Gambia, Liberia, Mauritius, Morocco, Mozambique, Niger, Senegal, South Africa, Sudan, Togo, Zambia, and Zimbabwe). To drop the observations in countries where the relevant question was not asked:
codebook COV18 
drop if COV18 == 94



//								DESCRIPTIVE STATISTICS


// Table 1: Descriptive Statistics 

summ prayer bin_prayer educ news_index traditional_media modern_media index_deprive ill_covid educ president male age christian muslim trad other_relig no_relig




********************************************************************************
*					CODES FOR EXECUTING THE REGRESSION MODELS			  	   *
********************************************************************************


// 								REGRESSION MODELS 

// Table 2: Ordered logit models regressing the relative effectiveness of prayer vs. vaccine on educational level and news consumption 

* Model 1: Ologit - Baseline model (education only)
ologit prayer educ, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 2: Ologit - Baseline model (News consumption only)
ologit prayer news_index, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 3: Ologit - Considering both explanatory variables simultaneously
ologit prayer educ news_index, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 4: Ologit - Adding control variables except religious affiliation
ologit prayer educ news_index index_deprive ill_covid president male age rural, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 5: Ologit - Including controls for religious affiliation
ologit prayer educ news_index index_deprive ill_covid president male age rural christian muslim trad other_relig, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 6: LPM - Robustness check using Linear probability model and binary dependnet variable
regress bin_prayer educ news_index index_deprive ill_covid president male age rural christian muslim trad other_relig, vce(robust)
* To obtain the AIC statistic
estat ic




//	Figure 4: Predicted probabilities showing the magnitude of the associations between educational level, news consumption, and  perceptions of prayer vs. vaccine efficacy

* Panel A: Educational level
ologit prayer educ, vce(robust)
*To obtain the marginal effects
margins, dydx(educ)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (educ, replace)


* Panel B: News index
ologit prayer news_index, vce(robust)
*To obtain the marginal effects
margins, dydx(news_index)
*To plot the marginal effects as a bar chart with confidence intervals
marginsplot, recast(bar) yline(0) name (news_index, replace)

* To combine the two graphs
graph combine educ news_index





///					APPENDIX

* Table A1: Distribution of sample across African countries
tab COUNTRY 


// Table A2: Robustness check using traditional and non-traditional news media

* Model 1: Ologit - Using traditional news media (i.e., television, newspapers, and radio)
ologit prayer traditional_media, vce(robust)
* To obtain the AIC statistic
estat ic

* Model 2: Ologit - Using non-traditional news media (i.e., social media and internet)
ologit prayer modern_media, vce(robust)
* To obtain the AIC statistic
estat ic
